package constants;

public enum ServerMessageType {

    BM_NOTICE((short) 0),
    BM_ALERT((short) 1),
    BM_SPEAKERCHANNEL((short) 2),
    BM_SPEAKERWORLD((short) 3),
    BM_SLIDE((short) 4),
    BM_EVENT((short) 5),
    BM_NOTICEWITHOUTPREFIX((short) 6),
    BM_UTILDLGEX((short) 7),
    BM_ITEMSPEAKER((short) 8),
    BM_SPEAKERBRIDGE((short) 9),
    BM_ARTSPEAKERWORLD((short) 10),
    BM_GACHAPONMSG((short) 11),
    BM_BLOWWEATHER((short) 12),
    BM_ANNOUNCED_QUEST_OPEN((short) 13),
    BM_ANNOUNCED_QUEST_CLOSED((short) 14),
    BM_MIRACLETIME((short) 15),
    BM_EVENTMSG_WITH_CHANNEL((short) 16),
    BM_LOTTERYITEMSPEAKER((short) 17),
    BM_LOTTERYITEMSPEAKER_WORLD((short) 18),
    BM_MONSTERLIFE_WORLDMSG((short) 19),
    BM_NOTICEWINDOW((short) 20),
    BM_PICKUP_ITEM_WORLD((short) 21),
    BM_MAKINGSKILLMEISTERITEM((short) 22),
    BM_SPEAKERWORLD_GUILDSKILL((short) 23),
    BM_WEATHERMSG((short) 24),
    HEART_TYPE((short) 26),
    BONE_TYPE((short) 27),
    GACHAPON_MEGAPHONE((short) 34),
    CAKE_TYPE((short) 40),
    PIE_TYPE((short) 50);

    private final short code;

    ServerMessageType(short code) {
        this.code = code;
    }

    public static ServerMessageType getByCode(int code) {
        for (ServerMessageType type : values()) {
            if (type.code == code) {
                return type;
            }
        }
        return BM_NOTICE;
    }

    public final short getCode() {
        return code;
    }
}
